package com.cr.backbone.hibenate;

import java.io.Serializable;
import java.util.List;

/**
 * 常用业务实现-业务层
 * @author huxh
 *
 * @param <T>
 */
public abstract class AppBaseServiceImpl<T extends Serializable>
		implements AppBaseService<T> {
	public AppBaseServiceImpl(){}
	
	protected AppBaseDAO<T> dao;
	
	public int count() {
		return dao.count();
	}

	public void delete(T t) {
		dao.delete(t);
	}

	public void deleteAll() {
		dao.deleteAll();
	}

	public void deleteById(Long id) {
		dao.deleteById(id);
	}

	public List<T> getList() {
		return dao.getList();
	}

	public T load(Long id) {
		return dao.load(id);
	}

	public T get(Long id) {
		return dao.get(id);
	}
	
	public Long save(T t) {
		return dao.save(t);
	}

	public void update(T t) {
		dao.update(t);
	}

	public AppBaseDAO<T> getDao() {
		return dao;
	}

	public void setDao(AppBaseDAO<T> dao) {
		this.dao = dao;
	}
	
	
	/**××××××××××××××××××××××××××××××××××××
	 * 分页
	 */

	/**
	 * 分页
	 * @methodDescribe
	 * @param query
	 * @param page
	 * @return
	 * @author xianghua.hu
	 * @date 2012-2-26 下午10:34:58
	 */
	public Pagination getPage(QueryParam query,Pagination page){
		return this.dao.getPageByCriteria(query, page);
	}
}
